/*
 * Created on 10.10.2006 by leck
 *
 */
package de.devisnik.eidle.flashlight;

import org.eclipse.core.runtime.preferences.InstanceScope;
import org.eclipse.jface.preference.BooleanFieldEditor;
import org.eclipse.jface.preference.DirectoryFieldEditor;
import org.eclipse.jface.preference.FieldEditorPreferencePage;
import org.eclipse.jface.preference.IntegerFieldEditor;
import org.eclipse.ui.IWorkbench;
import org.eclipse.ui.IWorkbenchPreferencePage;
import org.eclipse.ui.preferences.ScopedPreferenceStore;

public class FlashlightPreferencePage extends FieldEditorPreferencePage
		implements IWorkbenchPreferencePage {

	public FlashlightPreferencePage() {
		super("Flashlight", GRID);
		setPreferenceStore(new ScopedPreferenceStore(new InstanceScope(),
				FlashlightActivator.PLUGIN_ID));
	}

	// @Override
	protected void createFieldEditors() {
		final BooleanFieldEditor enabledEditor = new BooleanFieldEditor(
				FlashlightPreferences.KEY_USE_SCREENSHOT, "use screenshot",
				getFieldEditorParent());
		addField(enabledEditor);
		final DirectoryFieldEditor globalImagePathEditor = new DirectoryFieldEditor(
				FlashlightPreferences.KEY_GLOBAL_IMAGE_PATH, "image directory",
				getFieldEditorParent());
		addField(globalImagePathEditor);
		final IntegerFieldEditor presentationTimeEditor = new IntegerFieldEditor(
				FlashlightPreferences.KEY_PRESENTATION_TIME,
				"Presentation time (in s)", getFieldEditorParent());
		presentationTimeEditor.setValidRange(6, 600);
		addField(presentationTimeEditor);
		final IntegerFieldEditor diameterEditor = new IntegerFieldEditor(
				FlashlightPreferences.KEY_RELATIVE_DIAMETER,
				"Diameter (in percent)", getFieldEditorParent());
		diameterEditor.setValidRange(5, 100);
		addField(diameterEditor);
		final IntegerFieldEditor spotNumberEditor = new IntegerFieldEditor(
				FlashlightPreferences.KEY_SPOT_NUMBER, "Number of Spots",
				getFieldEditorParent());
		spotNumberEditor.setValidRange(1, 15);
		addField(spotNumberEditor);
	}

	public void init(final IWorkbench workbench) {
		// TODO Auto-generated method stub

	}

}
